隔离级别 RR

begin;
查询某一条数据;存在更新

where prefix = 'dz10021' 
for update;

update count set count = 11
where  prefix = 'dz10021';

insert into count values
('dz10021', 0 , 0);

end;
commit; ROLLBACK; = 释放锁了


事务特点:原子性 一致性

 dd

1. 排他锁, 使用间隙锁
2. 

select * from count 


set 
@@session.tx_isolation = 
'REPEATABLE-READ';


start transaction;

select * from count 
where prefix = '222'
for update;

insert into count values
('222', 0 , 0);

select * from count 
where prefix = 'dd';


commit;

?? 